package com.leonard.event.service;

import com.leonard.event.entity.UserBean;
import com.leonard.event.event.UserRegisterEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

/**
 * @description:
 * @author: qizheng.sun
 * @createDate: 2020/9/29
 * @version: 1.0
 */
@Service
public class UserService {

    @Autowired
    ApplicationContext applicationContext;

    /**
     * 用户注册方法
     * @param user
     */
    public void register(UserBean user)
    {
        //../省略其他逻辑

        //发布UserRegisterEvent事件
        applicationContext.publishEvent(new UserRegisterEvent(this,user));
    }

}
